-
- /**
- * Get useful response headers for GET/HEAD requests for a file with the given metadata
- * @param $metadata Array Contains this handler's unserialized getMetadata() for a file
- * @return Array
- */
- public function getContentHeaders( $metadata ) {
- if ( !isset( $metadata['Width'] ) || !isset( $metadata['Height'] ) ) {
- return [];
- }
-
- $dimensionsMetadata = [];
-
- if ( $this->autoRotateEnabled() && isset( $metadata['Orientation'] ) ) {
- switch ( $metadata['Orientation'] ) {
- case 5: // CCW flipped
- case 6: // CCW
- case 7: // CW flipped
- case 8: // CW
- $dimensionsMetadata['width'] = $metadata['Height'];
- $dimensionsMetadata['height'] = $metadata['Width'];
- break;
- }
- }
-
- if ( !isset( $dimensionsMetadata['width'] ) ) {
- $dimensionsMetadata['width'] = $metadata['Width'];
- $dimensionsMetadata['height'] = $metadata['Height'];
- }
-
- return parent::getContentHeaders( $dimensionsMetadata );
- }